/**
 * Anderground project - Subway maps processor application.
 * Copyright (C) 2008-2009 Eldar Abusalimov, Ilya Shurigyn
 * 
 * This file is part of Anderground.
 * 
 * Anderground is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * Anderground is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Anderground.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.anderground.core.util;

/**
 * @author Eldar Abusalimov (eldar.abusalimov@gmail.com)
 */
public class ColorUtils {

	public static final int BLACK = 0xff000000;
	public static final int BLUE = 0xff0000ff;
	public static final int CYAN = 0xff00ffff;
	public static final int DKGRAY = 0xff444444;
	public static final int GRAY = 0xff888888;
	public static final int GREEN = 0xff00ff00;
	public static final int LTGRAY = 0xffcccccc;
	public static final int MAGENTA = 0xffff00ff;
	public static final int RED = 0xffff0000;
	public static final int TRANSPARENT = 0x00000000;
	public static final int WHITE = 0xffffffff;
	public static final int YELLOW = 0xffffff00;

	/**
	 * Parses color from string. Forces Alpha channel to be FF.
	 * 
	 * @param colorString
	 * @return integer color representation
	 * @throws NumberFormatException
	 */
	public static int parse(String colorString) throws NumberFormatException {
		return 0xFF000000 | Integer.decode(colorString);
	}

	/**
	 * 
	 * @param color
	 * @return String color representation
	 */
	public static String format(int color) {
		return '#' + Integer.toHexString(0xFFFFFF & color);
	}

}
